package practice;

import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

public class Day16 {
    //分组
    //https://ac.nowcoder.com/acm/problem/229023
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int m = in.nextInt();
        int[] a = new int[n];
        Map<Integer,Integer> map = new HashMap<>();
        int maxValue = 0;
        for(int i = 0; i < n; i++) {
            a[i] = in.nextInt();
            map.put(a[i],map.getOrDefault(a[i],0) + 1);
            if(maxValue < map.getOrDefault(a[i],0)) {
                maxValue = map.get(a[i]);
            }
        }

        int ret = 0;
        for(int i = 1; i <= maxValue; i++) {
            int count = 0;
            for(Map.Entry entry : map.entrySet()) {
                int b = (int)entry.getValue();
                count += ((b / i) + (b % i == 0 ? 0 : 1));
            }
            if(count <= m) {
                ret = i;
                break;
            }
        }
        if(map.size() > m) {
            System.out.println(-1);
        }else {
            System.out.println(ret);
        }
    }
}
